package com.itheima.many_many.service;

import com.itheima.many_many.domain.Course;
import com.itheima.many_many.domain.Student;
import com.itheima.many_many.mapper.CourseMapper;
import com.itheima.mybatis02.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class ManyToMany {
    public static void main(String[] args) {
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        CourseMapper courseMapper = sqlSession.getMapper(CourseMapper.class);
        List<Course> courses = courseMapper.selectAll();
        for (Course cours : courses) {
            System.out.println(cours);
           /* System.out.println(cours.getId());
            System.out.println(cours.getName());
            List<Student> students = cours.getStudents();
            for (Student student : students) {
                System.out.println(student);
            }*/
        }
    }
}
